package cn.dyaln.fallbackFeignClient;

import cn.dylan.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {

    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public User handlerGet(Long id) {
                return new User(-1L, "熔断了", "触发熔断了！！！");
            }
        };
    }
}
